<template>
	<view class="wrapper">
		<custom-nav-bar :titleName="'自定义导航'"></custom-nav-bar>
		<view class="main-content" :style="[{top: customBar + 'px', height: `calc(100vh - ${customBar}px)`}]">
			<image class="logo" src="/static/logo.png" @click="getUserAvatar()"></image>
		</view>
	</view>
</template>

<script>
	import customNavBar from "@/components/custom-nav-bar.vue";
	
	export default {
		data() {
			const customBar	= uni.getStorageSync('CustomBar');
			return {
				customBar,
				title: 'Hello'
			}
		},
		components: {
			customNavBar,
		},
		onLoad() {
            // this.getUserAvatar();
		},
		methods: {
			getUserAvatar() {
			  // 调用uni.getUserInfo方法获取用户信息
			  uni.getUserProfile({
			    desc: '获取用户信息', // 设置desc为一个描述字符串
			    success: (res) => {
			      console.log('dadadada', res);
			      // 获取用户信息成功后，可以从res中获取到用户的头像信息
			      // const avatar = res.userInfo.avatarUrl;
			      // ...
			    },
			    fail: (err) => {
			      console.log(err);
			    }
			  });
			}

		}
	}
</script>

<style scoped lang="scss">
	.wrapper{
		width: 100vw;
		height: 100vh;
		.main-content{
			position: relative;
		}
	}
</style>
